// pages/module/withdrawal/withdrawalRecord/withdrawalRecord.js
import {dayForm} from '../../../utils/imapi.js'
Page({
  /**
   * 页面的初始数据
   */
  data: {
    recode_list:[
		{
			time:'2020.05.23',
			dd:'1',
			price:'20'
		}
	],
    img_list:"",
    page_index:1,
    page_size:30,
    qh:false,
    member_id:'',


  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad:  function (options) {
    
   //this.load_accbill_record()
     
    let member_id= options.member_id;
    this.setData({
      member_id:member_id
    })

    this.setData({
      recode_list:[]
    })

    this.load_day_commission_rpt(this.data.page_index)


  },

  
  load_day_commission_rpt:async function(page_index){
    let res = await dayForm({member_id:this.data.member_id,page_index:page_index,page_size:this.data.page_size,is_reverse:'1'})
    this.setData({
      recode_list:this.data.recode_list.concat(res.data),
	    page_index:page_index,
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom:async function () {
	  this.setData({
	    qh:true
	  })
	 if(this.data.qh){
    
    
		 let res = await dayForm({page_index:this.data.page_index+1,page_size:this.data.page_size,is_reverse:'1'})
     var list=this.data.recode_list.concat(res.data);
     

		 this.setData({
       recode_list:list,
       page_index:this.data.page_index+1
     })
     

		 setTimeout(()=>{
			 this.setData({
			   qh:false
			 })
		 },1000)
	 }
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})